from django.db import models

# Create your models here.
from django.contrib.auth.models import AbstractUser
from django.utils import timezone


class User(AbstractUser):
    telephone = models.CharField(max_length=11)
    introduction=models.TextField(blank=True)#个人介绍
    is_locked=models.BooleanField(blank=True,default=False) #是否被锁住

    REQUIRED_FIELDS = []


#用户地址表
class address(models.Model):
    user_id=models.ForeignKey(User,on_delete=models.CASCADE,related_name='addresses')
    user_name=models.CharField(max_length=50)#收货人的username
    user_phone=models.CharField(max_length=11)#收货人的电话
    default_flag=models.BooleanField(default=False)#是否是默认地址
    province_name=models.CharField(max_length=10)#省
    city_name=models.CharField(max_length=10)#市
    region_name=models.CharField(max_length=100)#详细地址
    create_time=models.DateTimeField(default=timezone.now)#用户的创建时间
    update_time=models.DateTimeField(default=timezone.now)#用户更新的时间
